#pragma once

#include <vector>
#include "Sprite.h"
#include "GameManagement.h"
#include "Camera.h"
#include "QuadTree.h"

// demo include library
#include "ContraEntity.h"
#include "ObstructionEntity.h"
#include "GameRunInput.h"
#include "EntityManager.h"
#include "TileManager.h"
#include "ViewPort.h"
#include "ArmyEntity.h"
#include "ItemEntity.h"
#include "EffectManager.h"

using namespace std;

class MapSystem;
class GameManagement;
class EntityMap;
//class EntityManager;
class GameRun
{
protected:
	
	Camera* _camera;
	GameManagement* _owner;
	long _timetick;
	bool isSprite;

	/* Manage tile to draw by viewport reference */
	TileManager* tileManager, *tileSpriteManager, *tileSpriteManager2, *tileSpriteManager3;
	CViewPort* viewPort;
	
	
	/// demo
	Sprite* _sprBackground;
	// Demo contra entity
	ContraEntity* _contraEntity;
	ArmyEntity* _armyEntity;
	ArmyEntity* _redsoldierEntity;
	ArmyEntity* _runningsoldierEntity;
	ItemEntity* _itemEntity;
	ObstructionEntity* _obstructionEntity;
	ObstructionEntity* _obstructionEntity1;
	ObstructionEntity* _obstructionEntity2;
	ObstructionEntity* _obstructionEntity3;
	ObstructionEntity* _obstructionEntity4;
	ObstructionEntity* _obstructionEntity5;
	ObstructionEntity* _obstructionEntity6;

	//Effect
	EffectManager* _effectManager;
	

	/* Game Run sub class to manage other component */
	GameRunInput* _gameInput;
	EntityManager* _entityManager;

	void _initSystem();
public:
	GameRun(GameManagement* owner);
	~GameRun();

	virtual void setInput(int keycode, bool onHold);
	Camera* getCamera();

	void onChangeMap();
	void updateDataOnChangeMap();
	void update();
	virtual void draw();
	GameManagement* getParent();

	//IInitialize
	virtual void init();
};

